﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace KTool2.Common
{
    class Constant
    {
        private static string assemblyDescription;
        private static string assemblyCopyright;
        private static string assemblyVersion;
        private static string assemblyName;
        private static string assemblyLocation;

        public static string ASSEMBLY_LOCATION
        {
            get
            {
                if (assemblyLocation == null)
                {
                    assemblyLocation = System.Reflection.Assembly.GetExecutingAssembly().Location;
                }

                return Constant.assemblyLocation;
            }
        }

        public static string ASSEMBLY_NAME
        {
            get
            {
                if (assemblyName == null)
                {
                    assemblyName = System.Reflection.Assembly.GetExecutingAssembly().FullName;
                }

                return Constant.assemblyName;
            }
        }

        public static string ASSEMBLY_VERSION
        {
            get
            {
                if (assemblyVersion == null)
                {
                    Constant.assemblyVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
                }

                return Constant.assemblyVersion;
            }
        }

        public static string ASSEMBLY_COPYRIGHT
        {
            get
            {
                if (assemblyCopyright == null)
                {
                    object[] attributes = System.Reflection.Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(System.Reflection.AssemblyCopyrightAttribute), false);

                    if (attributes.Length == 0)
                    {
                        Constant.assemblyCopyright = "";
                    }

                    Constant.assemblyCopyright = ((System.Reflection.AssemblyCopyrightAttribute)attributes[0]).Copyright;
                }

                return Constant.assemblyCopyright;
            }
        }

        public static string ASSEMBLY_DESCRIPTION
        {
            get
            {
                if (assemblyDescription == null)
                {
                    object[] attributes = System.Reflection.Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(System.Reflection.AssemblyDescriptionAttribute), false);

                    if (attributes.Length == 0)
                    {
                        Constant.assemblyCopyright = "";
                    }

                    Constant.assemblyDescription = ((System.Reflection.AssemblyDescriptionAttribute)attributes[0]).Description;
                }

                return Constant.assemblyDescription;
            }
        }

        public static readonly string APP_FOLDER = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Kanji Tool 2";

        public static readonly string ALL_CATEGORIES = "All categories";

        public static readonly string SETTING_FILE_PATH = APP_FOLDER + @"\Setting.kt2";

        public static readonly double TEXT_ANIMATION_TIME = 0.25;

        public static readonly int MAX_OF_HISTORY_ELEMENT = 5;

        public static readonly string CONNECTION_STRING = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" + System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).Substring("file\\:\\".Length - 1) + "\\KanjiDB.xls;Extended Properties=\"Excel 8.0;HDR=Yes;\"";

        public static readonly string RUN_LOCATION = @"Software\Microsoft\Windows\CurrentVersion\Run";

        public static readonly string MYSTERIOUS = "???";
    }
}
